<script setup>
import {useI18n} from "vue-i18n";
import {useThemesStore} from "@store";
import {SKILL_SECTION_INFO} from "@public/config.js";

const { t } = useI18n();

const themesStore = useThemesStore();
const themes = computed(() => themesStore.getThemes);
</script>

<template>
    <div id="skills" class="skills-section section-container">
        <div class="skill-title section-title">{{ t('mySkills') }}</div>
        <div class="skills-content section-content">
            <div class="skill-item animation-fade-in-out" v-for="item in SKILL_SECTION_INFO" :key="item.name">
                <div class="skill-item__name">{{ item.name }}</div>
                <div class="skill-item-info">
                    <el-popover :width="200" trigger="hover" :effect="themes" :content="t(`${item.name}Desc`)">
                        <template #reference>
                            <div class="skill-item__desc text-overflow">{{ t(`${item.name}Desc`) }}</div>
                        </template>
                    </el-popover>
                    <el-popover :width="200" trigger="hover" :effect="themes" :content="t(`${item.level}Desc`)">
                        <template #reference>
                            <div class="skill-item__level">{{ t(item.level) }}</div>
                        </template>
                    </el-popover>
                </div>
                <svg class="skill-icon" :aria-hidden="true">
                    <use class="svg-use" :href="'#icon-' + item.name"/>
                </svg>
            </div>
        </div>
    </div>
</template>

<style scoped lang="scss">
#skills {

    .skills-content {
        gap: 20px;

        .skill-item {
            user-select: none;
            cursor: default;
            flex-shrink: 0;
            border-radius: 10px;
            width: 240px;
            height: 100px;
            background-color: var(--md-sys-color-surface-container);
            position: relative;
            display: flex;
            flex-direction: column;
            padding: 10px 15px;
            overflow: hidden;

            &.active {

                .skill-icon {
                    opacity: 0.2;
                    height: 120px;
                }

                &:hover {
                    scale: 1.1;

                    .skill-icon {
                        opacity: 0.7;
                    }
                }
            }

            &__name {
                color: var(--md-sys-color-on-surface);
                font-size: 2.5rem;
                z-index: 1;
                flex: 1;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            &-info {
                display: flex;
                align-content: center;
                justify-content: space-between;
            }

            &__desc {
                color: #999;
                font-size: 12px;
                z-index: 1;
            }

            &__level {
                color: var(--md-sys-color-primary);
                font-size: 12px;
                margin-top: auto;
                z-index: 1;
                flex-shrink: 0;
                margin-left: 5px;
            }

            .skill-icon {
                position: absolute;
                width: 120px;
                height: 0;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                z-index: 0;
                opacity: 1;
            }
        }
    }


}
</style>
